#ifndef DEVICE_H
#define DEVICE_H

#include <QObject>
#include "modbus.h"
#include <QThread>
class Device:public QObject
{
    Q_OBJECT
public:
    Device();
    ~Device();
    void OpenDevice(QString,int);

    void SetChannel1Range(int);                     //设置通道1量程
    void SetChannel2Range(int);                     //设置通道2量程
    void SetDeviceType(int);                        //产品选型
    void Channel1ZeroCalibration();                 //通道1零点校准
    void Channel2ZeroCalibration();                 //通道2零点校准
    void Channel1InputFullCalibration(int);         //通道1输入满值校准
    void Channel2InputFullCalibration(int);         //通道2输入满值校准
    void Channel1ZeroAdjustment(short);             //通道1零点调试
    void Channel1FullAdjustment(short);             //通道1满值调试
    void Channel2ZeroAdjustment(short);             //通道2零点调试
    void Channel2FullAdjustment(short);             //通道2满值调试
    void SaveChannel1();                            //保存通道1
    void SaveChannel2();                            //保存通道2
    void SendFc6(unsigned char address,ushort start,ushort registers,short*value);
    void SlotsInit();
    float k=0;
    QThread thread;
    Modbus*modbus;
signals:
    void Signal_ToNewDevice();
    void Signal_ToOpenDevice(QString,int);
    void Signal_ToSendFc6(unsigned char address,ushort start,ushort registers, short*value);

public slots:
    void Slots_ToNewDevice();
    void Slots_ToOpenDevice(QString,int);
    void Slots_ToSendFc6(unsigned char address,ushort start,ushort registers,short*value);

};

#endif // DEVICE_H
